package com.tom.architect.day07.diy;

public class TextView {
	private Thread mThread;
	public TextView(){
		mThread = Thread.currentThread();
	}
	
	public void setText(CharSequence text){
		checkThread(); // 先检查线程

		System.out.println("更新UI成功："+text);
	}
	
	void checkThread() {
        if (mThread != Thread.currentThread()) {
            throw new RuntimeException(
                    "Only the original thread that created a view hierarchy can touch its views.");
        }
    }
}
